<?php

class Committee extends FMIS_Controller {

	public function __construct() {
		parent::__construct();
        $this->load->database();
        $this->load->model('committee/fmis_committee_model');
        $this->load->model('Faculty_Profile_Model');
	}

	public function view()
	{
        $profiles = $this->Faculty_Profile_Model->getAll();
        $committee = $this->fmis_committee_model->get_Committee();
		 $data = array(
                'page_title' => 'Committee',
                'tbl' => $committee,
             'committee'=> $committee,
             'profiles' => $profiles
					);
        
	    $this->setup_view('committee/view', $data);
	}

    public function update_view()
    {
        $profiles = $this->Faculty_Profile_Model->getAll();
        $committee = $this->fmis_committee_model->get_Committee();
        $data = array(
            'page_title' => 'Committee',
            'tbl' => $committee,
            'committee'=> $committee,
            'profiles' => $profiles
        );
        $this->setup_view('committee/edit', $data);
    }

    public function update()
    {
        //TODO update fmis.exp_fmis_committee_member
        $array_id = explode(' ', $this->input->post('input_id_list'));
        $this->fmis_committee_model->updateCommittee(
            array(
            'areahead' => $this->input->post('input-areahead'),
            'assistant' => $this->input->post('input-assistant'),
            'secretary' => $this->input->post('input-secretary'),
            'treasurer' => $this->input->post('input-treasurer'),
            'array_id_list' => $array_id
            )
        );
        $this->view();
        //$this->setup_view('test', );
    }
}

/* End of file pages.php */
/* Location: ./application/controllers/pages.php */